
$(document).ready(function(){
    $("#deleteDialog").dialog({
        modal: true,
        bgiframe: true,
        width: 300,
        height: 200,
        autoOpen: false
    });

    $.datepicker.regional.nl = {
        closeText: "Sluiten",
        prevText: "Vorrige",
        nextText: "Volgende",
        currentText: "Vandaag",
        monthNames: ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"],
        monthNamesShort: ["jan", "feb", "maa", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"],
        dayNames: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"],
        dayNamesShort: ["zon", "maa", "din", "woe", "don", "vri", "zat"],
        dayNamesMin: ["zo", "ma", "di", "wo", "do", "vr", "za"],
        dateFormat: "yy-mm-dd",
        firstDay: 1,
        isRTL: false
    };
    $.datepicker.setDefaults($.datepicker.regional.nl);

    $("a.confirm").click(function(e) {
        e.preventDefault();
        var theHREF = $(this).attr("href");

        $("#deleteDialog").dialog("option", "buttons", {
            "Ja" : function() {
                window.location.href = theHREF;
            },
            "Nee" : function() {
                $(this).dialog("close");
            }
        });
        $("#deleteDialog").dialog("open");
    });

    if($("#set1 *").length){
        $("#set1 *").tooltip({
            showURL: false
        });
    }

    $("a[rel~=external]").attr("target", "_blank");

    $("form#login").bind("submit", function() {
        if($("input#password").val().length > 0){
            $("input#password").val($.md5($("input#password").val()));
        }
    });
    
    $("input[type=submit]").click(function(){
        this.disabled = true;
        this.value = "Verstuurd";
        this.form.submit();
    });
});
